//按需引入element plus
const AutoImport = require('unplugin-auto-import/webpack')
const Components = require('unplugin-vue-components/webpack')
const { ElementPlusResolver } = require('unplugin-vue-components/resolvers')

module.exports = {

    //关闭eslint
    lintOnSave: false,
    //配置代理服务器处理跨域问题
    // devServer: {
    //     proxy: {
    //         // 发送的请求中含/api就会触发的代理服务器
    //         '/api': {
    //             //请求数据的后台服务器端口
    //             target: 'https://shop.zuofeibio.com/',
    //             //重写路径，如果后台的请求路径中不含/api可通过该属性将/api配置为空字符串
    //             pathRewrite: { '^/api': '' }
    //         }
    //     }
    // },
    //按需引入element plus
    outputDir: './build',
    configureWebpack: {
        resolve: {
            alias: {
                components: '@/components'
            }
        },
        //配置webpack自动按需引入element-plus，
        plugins: [
            AutoImport({
                resolvers: [ElementPlusResolver()]
            }),
            Components({
                resolvers: [ElementPlusResolver()]
            })
        ]
    },
}